﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LotteryVote.Logic.Exceptions
{
    /// <summary>
    /// 提示异常，可用于之间呈现在UI之上
    /// </summary>
    public class PromptException : Exception
    {
        /// <summary>
        /// 可能出现的异常参数.
        /// </summary>
        /// <value>
        /// The error params.
        /// </value>
        public object[] ErrorParams { get; set; }
        public PromptException(string message) : base(message) { }
        public PromptException(string message, params object[] errorParams)
            : base(message)
        {
            this.ErrorParams = errorParams;
        }
        public PromptException(string message, Exception innerException) : base(message, innerException) { }
        public PromptException(string message, Exception innerException, params object[] errorParams)
            : base(message, innerException)
        {
            this.ErrorParams = errorParams;
        }
        public string MessgeString()
        {
            if (ErrorParams != null)
                return string.Format(Message, ErrorParams);
            return Message;
        }
    }
}
